<%#
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-%>
buildscript {
    repositories {
        mavenLocal()
        mavenCentral()
        gradlePluginPortal()
        maven { url "https://repo.spring.io/plugins-release" }
    }
    dependencies {
        //jhipster-needle-gradle-buildscript-dependency - JHipster will add additional gradle build script plugins here
    }
}

plugins {
    id "java"
    id "maven-publish"
    id "idea"
    id "jacoco"
    id "org.springframework.boot"
    id "com.google.cloud.tools.jib"
    id "com.gorylenko.gradle-git-properties"
    <%_ if (enableSwaggerCodegen) { _%>
    id "org.openapi.generator"
    <%_ } _%>
    <%_ if (!skipClient) { _%>
    id "com.github.node-gradle.node"
    <%_ } _%>
    id "net.ltgt.apt-eclipse"
    id "net.ltgt.apt-idea"
    id "net.ltgt.apt"
    <%_ if (databaseType === 'sql' && !reactive) { _%>
    id "org.liquibase.gradle"
    <%_ } _%>
    id "org.sonarqube"
    id "io.spring.nohttp"
    //jhipster-needle-gradle-plugins - JHipster will add additional gradle plugins here
}

group = "<%= packageName %>"
version = "0.0.1-SNAPSHOT"

description = ""

sourceCompatibility=<%= JAVA_VERSION %>
targetCompatibility=<%= JAVA_VERSION %>
assert System.properties["java.specification.version"] == "1.8" || "1.9" || "10" || "11" || "12" || "13" || "14" || "15"

apply from: "gradle/docker.gradle"
apply from: "gradle/sonar.gradle"
<%_ if (enableSwaggerCodegen) { _%>
apply from: "gradle/swagger.gradle"
<%_ } _%>
//jhipster-needle-gradle-apply-from - JHipster will add additional gradle scripts to be applied here

if (project.hasProperty("prod") || project.hasProperty("gae")) {
    apply from: "gradle/profile_prod.gradle"
} else {
    apply from: "gradle/profile_dev.gradle"
}

if (project.hasProperty("war")) {
    apply from: "gradle/war.gradle"
}

if (project.hasProperty("gae")) {
    apply plugin: 'maven'
    apply plugin: 'org.springframework.boot.experimental.thin-launcher'
    apply plugin: 'io.spring.dependency-management'

    dependencyManagement {
        imports {
            mavenBom "io.github.jhipster:jhipster-dependencies:${jhipsterDependenciesVersion}"
        }
    }
    appengineStage.dependsOn thinResolve
}

<%_ if (serviceDiscoveryType || applicationType === 'gateway' || applicationType === 'microservice' || applicationType === 'uaa') { _%>
if (project.hasProperty("zipkin")) {
    apply from: "gradle/zipkin.gradle"
}
<%_ } _%>

idea {
    module {
        excludeDirs += files("node_modules")
    }
}

eclipse {
    sourceSets {
        main {
            java {
                srcDirs += ["build/generated/sources/annotationProcessor/java/main"]
            }
        }
    }
}

defaultTasks "bootRun"

springBoot {
    mainClassName = "<%= packageName %>.<%= mainClass %>"
}

test {
    useJUnitPlatform()
    exclude "**/*IT*", "**/*IntTest*"

    testLogging {
        events 'FAILED', 'SKIPPED'
    }
    // uncomment if the tests reports are not generated
    // see https://github.com/jhipster/generator-jhipster/pull/2771 and https://github.com/jhipster/generator-jhipster/pull/4484
    // ignoreFailures true
    reports.html.enabled = false
}

task integrationTest(type: Test) {
    useJUnitPlatform()
    description = "Execute integration tests."
    group = "verification"
    include "**/*IT*", "**/*IntTest*"
<%_ if (cucumberTests) { _%>
    exclude "**/*CucumberIT*"
<%_ } _%>

    testLogging {
        events 'FAILED', 'SKIPPED'
    }

<%_ if (databaseType === 'sql') { _%>
    if (project.hasProperty('testcontainers')) {
        environment 'spring.profiles.active', 'testcontainers'
    }
<%_ } _%>

    // uncomment if the tests reports are not generated
    // see https://github.com/jhipster/generator-jhipster/pull/2771 and https://github.com/jhipster/generator-jhipster/pull/4484
    // ignoreFailures true
    reports.html.enabled = false
}
<%_ if (cucumberTests) { _%>

task cucumberTest(type: Test) {
    description = "Execute cucumber BDD tests."
    group = "verification"
    include "**/*CucumberIT*"

    // uncomment if the tests reports are not generated
    // see https://github.com/jhipster/generator-jhipster/pull/2771 and https://github.com/jhipster/generator-jhipster/pull/4484
    // ignoreFailures true
    reports.html.enabled = false
}

check.dependsOn cucumberTest
<%_ } _%>

check.dependsOn integrationTest
task testReport(type: TestReport) {
    destinationDir = file("$buildDir/reports/tests")
    reportOn test
}

task integrationTestReport(type: TestReport) {
    destinationDir = file("$buildDir/reports/tests")
    reportOn integrationTest
}

<%_ if (cucumberTests) { _%>
task cucumberTestReport(type: TestReport) {
    destinationDir = file("$buildDir/reports/tests")
    reportOn cucumberTest
}

<%_ } _%>
<%_ if (databaseType === 'sql' && !reactive) { _%>
if (!project.hasProperty("runList")) {
    project.ext.runList = "main"
}

project.ext.diffChangelogFile = "<%= SERVER_MAIN_RES_DIR %>config/liquibase/changelog/" + new Date().format("yyyyMMddHHmmss") + "_changelog.xml"

liquibase {
    activities {
        main {
            driver "<% if (devDatabaseType === 'mysql') { %>com.mysql.cj.jdbc.Driver<% } else if (devDatabaseType === 'mariadb') { %>org.mariadb.jdbc.Driver<% } else if (devDatabaseType === 'postgresql') { %>org.postgresql.Driver<% } else if (devDatabaseType === 'h2Disk') { %>org.h2.Driver<% } else if (devDatabaseType === 'oracle') { %>oracle.jdbc.OracleDriver<% } %>"
            url "<% if (['mysql', 'mariadb', 'postgresql', 'mssql'].includes(devDatabaseType)) { %><%- getJDBCUrl(devDatabaseType, { hostname: 'localhost', databaseName: baseName, skipExtraOptions: true }) %><% } else if (devDatabaseType === 'h2Disk') { %><%- getJDBCUrl(devDatabaseType, { localDirectory: './build/h2db/db', databaseName: lowercaseBaseName, skipExtraOptions: true }) %><% } else if (devDatabaseType === 'oracle') { %><%- getJDBCUrl(devDatabaseType, { hostname: 'localhost', databaseName: 'xe', skipExtraOptions: true}) %><% } %>"
            username "<% if (devDatabaseType === 'mysql') { %>root<% } else if (devDatabaseType === 'postgresql' || devDatabaseType === 'h2Disk' || devDatabaseType === 'h2Memory') { %><%= baseName %><% } else if (devDatabaseType === 'mssql') { %>SA<% } %>"
            password "<% if (devDatabaseType === 'mssql') { %>yourStrong(!)Password<% } %>"
            changeLogFile "<%= SERVER_MAIN_RES_DIR %>config/liquibase/master.xml"
            defaultSchemaName "<% if (devDatabaseType === 'mysql') { %><%= baseName %><% } else if (devDatabaseType === 'postgresql') { %><% } %>"
            logLevel "debug"
            classpath "<%= SERVER_MAIN_RES_DIR %>"
        }
        diffLog {
            driver "<% if (devDatabaseType === 'mysql') { %>com.mysql.cj.jdbc.Driver<% } else if (devDatabaseType === 'mariadb') { %>org.mariadb.jdbc.Driver<% } else if (devDatabaseType === 'postgresql') { %>org.postgresql.Driver<% } else if (devDatabaseType === 'h2Disk') { %>org.h2.Driver<% } else if (devDatabaseType === 'oracle') { %>oracle.jdbc.OracleDriver<% } %>"
            url "<% if (['mysql', 'mariadb', 'postgresql', 'mssql'].includes(devDatabaseType)) { %><%- getJDBCUrl(devDatabaseType, { hostname: 'localhost', databaseName: baseName, skipExtraOptions: true }) %><% } else if (devDatabaseType === 'h2Disk') { %><%- getJDBCUrl(devDatabaseType, { localDirectory: './build/h2db/db', databaseName: lowercaseBaseName, skipExtraOptions: true }) %><% } else if (devDatabaseType === 'oracle') { %><%- getJDBCUrl(devDatabaseType, { hostname: 'localhost', databaseName: 'xe', skipExtraOptions: true}) %><% } %>"
            username "<% if (devDatabaseType === 'mysql') { %>root<% } else if (devDatabaseType === 'postgresql' || devDatabaseType === 'h2Disk' || devDatabaseType === 'h2Memory') { %><%= baseName %><% } else if (devDatabaseType === 'mssql') { %>SA<% } %>"
            password "<% if (devDatabaseType === 'mssql') { %>yourStrong(!)Password<% } %>"
            changeLogFile project.ext.diffChangelogFile
            referenceUrl "hibernate:spring:<%= packageName %>.domain?dialect=<% if (devDatabaseType === 'mysql') { %>org.hibernate.dialect.MySQL8Dialect<% } else if (devDatabaseType === 'mariadb') { %>org.hibernate.dialect.MariaDB103Dialect<% } else if (devDatabaseType === 'postgresql') { %>io.github.jhipster.domain.util.FixedPostgreSQL10Dialect<% } else if (devDatabaseType === 'h2Disk') { %>org.hibernate.dialect.H2Dialect<% } else if (devDatabaseType === 'oracle') { %>org.hibernate.dialect.Oracle12cDialect<% } else if (devDatabaseType === 'mssql') { %>org.hibernate.dialect.SQLServer2012Dialect<% } %>&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy"
            defaultSchemaName "<% if (devDatabaseType === 'mysql') { %><%= baseName %><% } else if (devDatabaseType === 'postgresql') { %><% } %>"
            logLevel "debug"
            classpath "$buildDir/classes/java/main"
            <%_ if (authenticationType === 'oauth2') { _%>
            excludeObjects "oauth_access_token, oauth_approvals, oauth_client_details, oauth_client_token, oauth_code, oauth_refresh_token"
            <%_ } _%>
        }
    }

    runList = project.ext.runList
}
<%_ } _%>

gitProperties {
    failOnNoGitDirectory = false
    keys = ["git.branch", "git.commit.id.abbrev", "git.commit.id.describe"]
}

checkstyle {
    toolVersion '${checkstyleVersion}'
    configFile file("checkstyle.xml")
    checkstyleTest.enabled = false
}
nohttp {
    source.include "build.gradle", "README.md"
}

configurations {
    providedRuntime
    implementation.exclude module: "spring-boot-starter-tomcat"
    all {
        resolutionStrategy {
            // Inherited version from Spring Boot can't be used because of regressions:
            // To be removed as soon as spring-boot use the same version
            force 'org.liquibase:liquibase-core:<%= LIQUIBASE_VERSION %>'
        }
    }
}

repositories {
    mavenLocal()
    mavenCentral()
    jcenter()
    <%_ if (!SPRING_BOOT_VERSION.endsWith('RELEASE')) { _%>
    maven { url 'https://repo.spring.io/milestone' }
    <%_ } _%>
    <%_ if (reactive && databaseType === 'sql' || JHIPSTER_DEPENDENCIES_VERSION.endsWith('-SNAPSHOT')) { _%>
    maven {
        url "https://oss.sonatype.org/content/repositories/snapshots/"
        mavenContent {
            snapshotsOnly()
        }
    }
    <%_ } _%>
    //jhipster-needle-gradle-repositories - JHipster will add additional repositories
}

dependencies {
    // import JHipster dependencies BOM
    if (!project.hasProperty("gae")) {
        implementation platform("io.github.jhipster:jhipster-dependencies:${jhipsterDependenciesVersion}")
    }

    // Use ", version: jhipsterDependenciesVersion, changing: true" if you want
    // to use a SNAPSHOT release instead of a stable release
    implementation group: "io.github.jhipster", name: "jhipster-framework"<% if (reactive) { %>, {
        exclude group: "org.springframework", module: "spring-webmvc"
    }<% } %>
    <%_ // This is useful for major Spring Boot migration
    if (!SPRING_BOOT_VERSION.endsWith('RELEASE')) { _%>
    runtime "org.springframework.boot:spring-boot-properties-migrator"
    <%_ } _%>
    implementation "javax.annotation:javax.annotation-api"
    <%_ if (cacheProvider !== 'no') { _%>
    implementation "org.springframework.boot:spring-boot-starter-cache"
    <%_ } _%>
    implementation "io.dropwizard.metrics:metrics-core"
    implementation "io.micrometer:micrometer-registry-prometheus"
    implementation "net.logstash.logback:logstash-logback-encoder"
    implementation "com.fasterxml.jackson.datatype:jackson-datatype-hppc"
    implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310"
    <%_ if (databaseType === 'sql') { _%>
    implementation "com.fasterxml.jackson.module:jackson-module-jaxb-annotations"
        <%_ if (!reactive) { _%>
    implementation "com.fasterxml.jackson.datatype:jackson-datatype-hibernate5"
        <%_ } _%>
    <%_ } _%>
    implementation "com.fasterxml.jackson.core:jackson-annotations"
    implementation "com.fasterxml.jackson.core:jackson-databind"
    <%_ if (applicationType === 'gateway' && authenticationType === 'uaa') { _%>
    implementation "org.apache.httpcomponents:httpclient"
    <%_ } _%>
    <%_ if (cacheProvider === 'hazelcast') { _%>
    implementation "com.hazelcast:hazelcast"
    <%_ } _%>
    <%_ if (cacheProvider === 'hazelcast' && enableHibernateCache) { _%>
    implementation "com.hazelcast:hazelcast-hibernate53"
    <%_ } _%>
    <%_ if (cacheProvider === 'hazelcast') { _%>
    implementation "com.hazelcast:hazelcast-spring"
    <%_ } _%>
    <%_ if (cacheProvider === 'infinispan') { _%>
    implementation "org.infinispan:infinispan-hibernate-cache-v53"
    implementation "org.infinispan:infinispan-spring-boot-starter-embedded"
    implementation "org.infinispan:infinispan-core"
    implementation "org.infinispan:infinispan-jcache"
    <%_ } _%>
    <%_ if (cacheProvider === 'memcached') { _%>
    implementation "com.google.code.simple-spring-memcached:spring-cache"
    implementation "com.google.code.simple-spring-memcached:xmemcached-provider"
    implementation "com.googlecode.xmemcached:xmemcached"
    <%_ } _%>
    <%_ if (cacheProvider === 'redis') { _%>
    implementation "org.redisson:redisson"
        <%_ if (enableHibernateCache) { _%>
    implementation "org.hibernate:hibernate-jcache"
        <%_ } _%>
    <%_ } _%>
    <%_ if (['ehcache', 'caffeine', 'hazelcast', 'infinispan', 'redis'].includes(cacheProvider) || applicationType === 'gateway') { _%>
    implementation "javax.cache:cache-api"
    <%_ } _%>
    <%_ if (databaseType === 'sql') { _%>
    implementation "org.hibernate:hibernate-core"
    implementation "com.zaxxer:HikariCP"
    <%_ } _%>
    implementation "org.apache.commons:commons-lang3"
    <%_ if (databaseType === 'cassandra' || databaseType === 'couchbase' || applicationType === 'gateway') { _%>
    implementation "commons-codec:commons-codec"
    <%_ } _%>
    <%_ if (enableSwaggerCodegen) { _%>
    implementation "org.openapitools:jackson-databind-nullable:${jacksonDatabindNullableVersion}"
    <%_ } _%>
    implementation "javax.transaction:javax.transaction-api"
    <%_ if (databaseType === 'cassandra') { _%>
    implementation "org.lz4:lz4-java"
    <%_ } _%>
    <%_ if (cacheProvider === 'ehcache') { _%>
    implementation "org.ehcache:ehcache"
        <%_ if (enableHibernateCache) { _%>
    implementation "org.hibernate:hibernate-jcache"
        <%_ } _%>
    <%_ } _%>
    <%_ if (cacheProvider === 'caffeine') { _%>
    implementation "com.github.ben-manes.caffeine:caffeine:${caffeineVersion}"
    implementation "com.github.ben-manes.caffeine:jcache:${caffeineVersion}"
    implementation "com.typesafe:config:${typesafeConfigVersion}"
        <%_ if (enableHibernateCache) { _%>
    implementation "org.hibernate:hibernate-jcache"
        <%_ } _%>
    <%_ } _%>
    <%_ if (databaseType === 'sql') { _%>
        <%_ if (!reactive) { _%>
    implementation "org.hibernate:hibernate-entitymanager"
        <%_ } _%>
    implementation "org.hibernate.validator:hibernate-validator"
    implementation "org.liquibase:liquibase-core"
        <%_ if (!reactive) { _%>
    liquibaseRuntime "org.liquibase:liquibase-core"
    liquibaseRuntime "org.liquibase.ext:liquibase-hibernate5:${liquibaseHibernate5Version}"
    liquibaseRuntime sourceSets.main.compileClasspath
        <%_ } _%>
    <%_ } _%>
    implementation "org.springframework.boot:spring-boot-loader-tools"
    implementation "org.springframework.boot:spring-boot-starter-mail"
    implementation "org.springframework.boot:spring-boot-starter-logging"
    implementation "org.springframework.boot:spring-boot-starter-actuator"
    implementation "org.springframework.boot:spring-boot-starter-aop"
    <%_ if (databaseType === 'sql') { _%>
        <%_ if (!reactive) { _%>
    implementation "org.springframework.boot:spring-boot-starter-data-jpa"
        <%_ } else { _%>
    implementation "org.springframework.boot:spring-boot-starter-data-r2dbc"
        <%_ } _%>
    <%_ } _%>
    <%_ if (searchEngine === 'elasticsearch') { _%>
    implementation "org.springframework.boot:spring-boot-starter-data-elasticsearch"
    <%_ } _%>
    <%_ if (['mongodb', 'cassandra', 'couchbase'].includes(databaseType)) { _%>
    implementation "org.springframework.boot:spring-boot-starter-data-<%= databaseType %><% if (reactive) { %>-reactive<% } %>"
    <%_ } _%>
    <%_ if (databaseType === 'mongodb' && reactive) { _%>
    // Mongock doesn't support reactive yet, so this dependency is necessary.
    // See https://github.com/jhipster/generator-jhipster/pull/12536#issuecomment-696683592 for more information.
    implementation "org.springframework.boot:spring-boot-starter-data-mongodb"
    <%_ } _%>
    <%_ if (databaseType === 'neo4j') { _%>
    implementation "org.neo4j.springframework.data:spring-data-neo4j-rx-spring-boot-starter"
    implementation "eu.michael-simons.neo4j:neo4j-migrations-spring-boot-starter"
    // This is done here explicitly as dependency resolution seems to have changed recently such that the validation starter
    // and therefore hibernate validators is not included anymore
    implementation "org.springframework.boot:spring-boot-starter-validation"
    testImplementation "org.testcontainers:neo4j"
    testImplementation 'org.testcontainers:junit-jupiter'
    <%_ } _%>
    <%_ if (prodDatabaseType === 'mysql') { _%>
    testImplementation "org.testcontainers:mysql"
    <%_ } _%>
    <%_ if (prodDatabaseType === 'mariadb') { _%>
    testImplementation "org.testcontainers:mariadb"
    <%_ } _%>
    <%_ if (prodDatabaseType === 'postgresql') { _%>
    testImplementation "org.testcontainers:postgresql"
    <%_ } _%>
    <%_ if (prodDatabaseType === 'mssql') { _%>
    testImplementation "org.testcontainers:mssqlserver"
    <%_ } _%>
    <%_ if (prodDatabaseType === 'oracle' && !reactive) { _%>
    testImplementation "org.testcontainers:oracle-xe"
    <%_ } _%>
    <%_ if (messageBroker === 'kafka') { _%>
        <%_ if (!reactive) { _%>
    implementation "org.apache.kafka:kafka-clients"
        <%_ } else { _%>
    implementation "io.projectreactor.kafka:reactor-kafka"
        <%_ } _%>
    <%_ } _%>
    implementation "org.springframework.boot:spring-boot-starter-security"
    implementation ("org.springframework.boot:spring-boot-starter-web<% if (reactive) { %>flux<% } %>") {
        exclude module: "spring-boot-starter-tomcat"
    }
    <%_ if (!reactive) { _%>
    implementation "org.springframework.boot:spring-boot-starter-undertow"
    <%_ } _%>
    <%_ if (reactive) { _%>
    implementation "org.springframework.boot:spring-boot-starter-validation"
    implementation "io.netty:netty-tcnative-boringssl-static"
    <%_ } _%>
    <%_ if (websocket === 'spring-websocket') { _%>
    implementation "org.springframework.boot:spring-boot-starter-websocket"
    <%_ } _%>
    implementation "org.springframework.boot:spring-boot-starter-thymeleaf"
    implementation "org.zalando:problem-spring-web<% if (reactive) { %>flux<% } %>"
    <%_ if (databaseType === 'cassandra') { _%>
    implementation "com.datastax.oss:java-driver-mapper-runtime"
    <%_ } _%>
    <%_ if (applicationType === 'gateway') { _%>
        <%_ if (!reactive) { _%>
    implementation "org.springframework.cloud:spring-cloud-starter-netflix-zuul"
        <%_ } else { _%>
    implementation "org.springframework.cloud:spring-cloud-starter-gateway"
        <%_ } _%>
    implementation "com.github.vladimir-bukhtoyarov:bucket4j-core"
    implementation "com.github.vladimir-bukhtoyarov:bucket4j-jcache"
    <%_ } _%>
    <%_ if (applicationType === 'microservice' || applicationType === 'gateway' || applicationType === 'uaa') { _%>
    implementation "org.springframework.cloud:spring-cloud-starter"
    implementation "org.springframework.cloud:spring-cloud-starter-netflix-ribbon"
    implementation "org.springframework.cloud:spring-cloud-starter-netflix-hystrix"
    implementation "org.springframework.retry:spring-retry"
    <%_ } _%>
    <%_ if (serviceDiscoveryType === 'eureka') { _%>
    implementation "org.springframework.cloud:spring-cloud-starter-netflix-eureka-client"
    implementation "org.springframework.cloud:spring-cloud-starter-config"
    <%_ } _%>
    <%_ if (serviceDiscoveryType === 'consul') { _%>
    implementation "org.springframework.cloud:spring-cloud-starter-consul-discovery"
    implementation "org.springframework.cloud:spring-cloud-starter-consul-config"
    <%_ } _%>
    <%_ if (authenticationType === 'uaa' || (applicationType === 'gateway' && authenticationType === 'oauth2' && reactive)) { _%>
    implementation "org.springframework.cloud:spring-cloud-starter-security"
    <%_ } _%>
    <%_ if (applicationType === 'microservice' || applicationType === 'gateway' || applicationType === 'uaa') { _%>
    implementation "org.springframework.cloud:spring-cloud-starter-openfeign"
    <%_ } _%>
    implementation "org.springframework.cloud:spring-cloud-spring-service-connector"
    implementation "org.springframework.security:spring-security-config"
    implementation "org.springframework.security:spring-security-data"
    implementation "org.springframework.security:spring-security-web"
    <%_ if (websocket === 'spring-websocket') { _%>
    implementation "org.springframework.security:spring-security-messaging"
    <%_ } _%>
    <%_ if (authenticationType === 'oauth2') { _%>
    implementation "org.springframework.boot:spring-boot-starter-oauth2-client"
    implementation "org.springframework.boot:spring-boot-starter-oauth2-resource-server"
    <%_ } _%>
    <%_ if (authenticationType === 'jwt') { _%>
    implementation "io.jsonwebtoken:jjwt-api"
    if (!project.hasProperty("gae")) {
        runtimeOnly "io.jsonwebtoken:jjwt-impl"
        <% if (reactive) { %>implementation<% } else { %>runtimeOnly<% } %> "io.jsonwebtoken:jjwt-jackson"
    } else {
        implementation "io.jsonwebtoken:jjwt-impl"
        implementation "io.jsonwebtoken:jjwt-jackson"
    }
    <%_ } _%>
    <%_ if (authenticationType === 'uaa') { _%>
    implementation "org.springframework.security.oauth:spring-security-oauth2"
    implementation "org.springframework.security:spring-security-jwt"
    <% if (databaseType === 'sql') { %>implementation<% } else { %>runtimeOnly<% } %> "org.glassfish.jaxb:jaxb-runtime:${jaxbRuntimeVersion}"
    <%_ } _%>
    <%_ if (databaseType === 'mongodb') { _%>
    implementation "com.github.cloudyrock.mongock:mongock-spring-v5"
    implementation "com.github.cloudyrock.mongock:mongodb-springdata-v3-driver"
    <%_ } _%>
    <%_ if (databaseType === 'couchbase') { _%>
    implementation "com.github.differentway:couchmove"
    implementation "com.couchbase.client:java-client"
    implementation "com.couchbase.client:encryption"
    <%_ } _%>
    implementation ("io.springfox:springfox-oas")
    implementation ("io.springfox:springfox-swagger2")
    implementation "io.springfox:springfox-bean-validators"
    <%_ if (prodDatabaseType === 'mysql') { _%>
    implementation "mysql:mysql-connector-java"
        <%_ if (!reactive) { _%>
    liquibaseRuntime "mysql:mysql-connector-java"
        <%_ } else { _%>
    implementation "dev.miku:r2dbc-mysql"
        <%_ } _%>
    <%_ } _%>
    <%_ if (prodDatabaseType === 'postgresql') { _%>
    implementation "org.postgresql:postgresql"
        <%_ if (!reactive) { _%>
    liquibaseRuntime "org.postgresql:postgresql"
        <%_ } else { _%>
    implementation "io.r2dbc:r2dbc-postgresql"
        <%_ } _%>
    <%_ } _%>
    <%_ if (prodDatabaseType === 'mariadb') { _%>
    implementation "org.mariadb.jdbc:mariadb-java-client"
        <%_ if (!reactive) { _%>
    liquibaseRuntime "org.mariadb.jdbc:mariadb-java-client"
        <%_ } else { _%>
        implementation "org.mariadb:r2dbc-mariadb:${r2dbcMariadbVersion}"
        <%_ } _%>
    <%_ } _%>
    <%_ if (prodDatabaseType === 'mssql') { _%>
    implementation "com.microsoft.sqlserver:mssql-jdbc"
    implementation "com.github.sabomichal:liquibase-mssql"
        <%_ if (!reactive) { _%>
    liquibaseRuntime  "com.microsoft.sqlserver:mssql-jdbc"
    liquibaseRuntime "com.github.sabomichal:liquibase-mssql"
        <%_ } else { _%>
    implementation "io.r2dbc:r2dbc-mssql"
        <%_ } _%>
    <%_ } _%>
    implementation "org.mapstruct:mapstruct:${mapstructVersion}"
    annotationProcessor "org.mapstruct:mapstruct-processor:${mapstructVersion}"
    <%_ if (databaseType === 'sql') { _%>
    annotationProcessor "org.hibernate:hibernate-jpamodelgen:${hibernateVersion}"
    annotationProcessor "org.glassfish.jaxb:jaxb-runtime:${jaxbRuntimeVersion}"
    <%_ } _%>
    <%_ if (databaseType === 'cassandra') { _%>
    annotationProcessor "com.datastax.oss:java-driver-mapper-processor:${cassandraDriverVersion}"
    <%_ } _%>
    annotationProcessor "org.springframework.boot:spring-boot-configuration-processor:${springBootVersion}"
    <%_ if (databaseType === 'cassandra') { _%>
    testImplementation ("org.cassandraunit:cassandra-unit-spring") {
        exclude(group: "org.slf4j")
    }
    testImplementation "org.testcontainers:database-commons"
    <%_ } _%>
    <%_ if (cucumberTests) { _%>
    testImplementation "io.cucumber:cucumber-junit"
    testImplementation "io.cucumber:cucumber-java"
    testImplementation "io.cucumber:cucumber-spring"
    <%_ } _%>
    testImplementation ("org.springframework.boot:spring-boot-starter-test") {
        <%_ if (cucumberTests === false) { _%>
        exclude group: "org.junit.vintage", module: "junit-vintage-engine"
        <%_ } _%>
    }
    testImplementation "org.springframework.security:spring-security-test"
    testImplementation "org.springframework.boot:spring-boot-test"
    <%_ if (reactive) { _%>
    // Temporarily disabled see https://github.com/jhipster/generator-jhipster/issues/11599
    // testImplementation "io.projectreactor.tools:blockhound-junit-platform:${blockhoundJunitPlatformVersion}"
    // testRuntimeOnly 'org.junit.platform:junit-platform-launcher:${junitPlatformLauncherVersion}'
    <%_ } _%>
    testImplementation "com.tngtech.archunit:archunit-junit5-api:${archunitJunit5Version}"
    testRuntimeOnly "com.tngtech.archunit:archunit-junit5-engine:${archunitJunit5Version}"
    <%_ if (databaseType === 'mongodb') { _%>
    testImplementation "de.flapdoodle.embed:de.flapdoodle.embed.mongo"
    <%_ } _%>
    <%_ if (databaseType === 'couchbase') { _%>
    testImplementation "org.testcontainers:couchbase"
    <%_ } _%>
    <%_ if (databaseType === 'sql') { _%>
    testImplementation "com.h2database:h2"
        <%_ if (reactive) { _%>
    testImplementation "io.r2dbc:r2dbc-h2"
        <%_ } _%>
    <%_ } _%>
    <%_ if (devDatabaseType === 'h2Disk' || devDatabaseType === 'h2Memory') { _%>
        <%_ if (!reactive) { _%>
    liquibaseRuntime "com.h2database:h2"
        <%_ } else { _%>
    implementation "io.r2dbc:r2dbc-h2"
        <%_ } _%>
    <%_ } _%>
    <%_ if (prodDatabaseType === 'oracle') { _%>
    implementation "com.oracle.database.jdbc:ojdbc8"
    liquibaseRuntime "com.oracle.database.jdbc:ojdbc8"
    <%_ } _%>
    <%_ if (messageBroker === 'kafka') { _%>
    testImplementation "org.testcontainers:kafka"
    <%_ } _%>
    <%_ if (cacheProvider === 'redis') { %>
    testImplementation "org.testcontainers:testcontainers"
    <%_ } _%>
    //jhipster-needle-gradle-dependency - JHipster will add additional dependencies here
}

if (project.hasProperty("gae")) {
    task createPom {
        def basePath = 'build/resources/main/META-INF/maven'
        doLast {
            pom {
                withXml(dependencyManagement.pomConfigurer)
            }.writeTo("${basePath}/${project.group}/${project.name}/pom.xml")
        }
    }
    bootJar.dependsOn = [createPom]
}

task cleanResources(type: Delete) {
    delete "build/resources"
}

wrapper {
    gradleVersion = "<%= GRADLE_VERSION %>"
}

<%_ if (!skipClient) { _%>

if (project.hasProperty("nodeInstall")) {
    node {
        version = "${nodeVersion}"
        npmVersion = "${npmVersion}"
        download = true
    }
}
<%_ } _%>
<%_ if (embeddableLaunchScript) { _%>

bootJar {
    launchScript()
}
<%_ } _%>
compileJava.dependsOn processResources
processResources.dependsOn bootBuildInfo
